package com.whtq.front.common.model.request;

import com.baomidou.mybatisplus.plugins.Page;
import com.github.pagehelper.PageHelper;

/**
 * Created by
 *
 * @author wmi
 * @date 2021/9/14 - 19:09.
 * @description
 */
public class BasePageReq {

    /**
     * 当前页数
     */
    private Integer pageNum;

    /**
     * 每页条数
     */
    private Integer pageSize;
    public com.github.pagehelper.Page<Object> initPage(){
        return PageHelper.startPage(1, 100);
    }

    public Integer getPageNum() {
        return pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Page toPage() {
        if (null == pageNum) {
            pageNum = 1;
        }
        // default pageSize = 1
        if (null == pageSize) {
            pageSize = 10;
        }
        return new Page(pageNum, pageSize);
    }


}
